// components/col-list/col-list.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    list: Object,
    text: String,
    action:String
  },

  /**
   * 组件的初始数据
   */
  data: {
    tabIndex: 0,
    isDark:''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    setTabIndex(e) {
      let { index } = e.target.dataset
      this.setData({
        tabIndex: index
      })
    },
    changeSwiper(e) {
      this.setData({
        tabIndex: e.detail.current

      })
    },

    goTomMoreNovels() {


      let reg = /[0-9]+$/
      let id = reg.exec(this.properties.action) ? reg.exec(this.properties.action)[0] : reg.exec(this.properties.action)
      if (id || id == 0) {
        console.log(this.properties.action);
        wx.navigateTo({
          url: `../../pages/morenovels/morenovels?text=${this.properties.text}&&id=` + reg.exec(this.properties.action)[0],
        })
      }


    }

    
  },


  lifetimes:{
    ready:function () {
    let storageDark = wx.getStorageSync('storageDark') ? wx.getStorageSync('storageDark') : false
    this.setData({
      isDark: storageDark
    })
    }
  }
})
